const mongoose = require('mongoose');

const moment=require('moment')
const Schema=mongoose.Schema;
let goodSchema=new Schema({
    imgPath:String,
    goodsName:String,
    integral:Number,
    market_priece:Number,
    inventory:Number,
    createTime: {
        type: Date,
        default: Date.now
    }
    
},{
    timestamps: { createdAt: 'createTime'}
})
goodSchema.virtual('createdAt').get(function () {
    return moment(this.createTime).format('YYYY-MM-DD');
  });
module.exports=mongoose.model('goods',goodSchema)